package leetcode_day._2021._202106._1120;

/**
 * @author yzh
 * @version 1.0
 * @date 2021/6/14 20:27
 * 猜数字大小
 * 算法：二分查找
 */
public class _14_374 {

    public int guessNumber(int n) {
        int start = 1, end = n;
        while (start <= end) {
            int mid = start + (end - start) / 2;
            if (guess(mid) == 0) return mid;
            if (guess(mid) == -1) end = mid - 1;
            else start = mid + 1;
        }
        return start;
    }

    private int guess(int i) {
        return 0;
    }

}
